package com.qf.stock.controller;

import com.qf.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StockController {

    @Value("${server.port}")
    private int port;

    @Autowired
    private StockService stockService;

    @GetMapping("/stock/test")
    public String test(){
        return "Stock Hello Nacos!!" + port;
    }


    @GetMapping("/stock/decr")
    public String decrement(){
        stockService.decr();
        return "ok";
    }
}
